package com.docking.heylo.web.controller;


import com.docking.heylo.dao.entity.AppVersion;
import com.docking.heylo.service.IAppVersionService;
import com.docking.heylo.web.dto.PageDto;
import com.docking.heylo.web.utils.ResultUtil;
import com.docking.heylo.web.vo.BaseVo;
import com.github.pagehelper.PageInfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
 * APP 版本管理
 *
 */
@RestController
@RequestMapping("/appVersion")
public class AppVersionController {

    @Autowired
    private IAppVersionService appVersionService;


    /***
     * APP 版本列表
     *
     * @param page
     * @return
     */
    @PostMapping("/list")
    public BaseVo list(@RequestBody PageDto page){
        PageInfo<AppVersion> pages = appVersionService.list(page);
        return ResultUtil.success("成功", pages);
    }


    /***
     * 发布新版本
     *
     * @param version
     * @return
     */
    @PostMapping("/push")
    public BaseVo push(@RequestBody AppVersion version){
        appVersionService.push(version);
        return ResultUtil.success("成功");
    }

    /***
     * 发布
     *
     * @param version
     * @return
     */
    @PostMapping("/release")
    public BaseVo release(@RequestBody AppVersion version){
        appVersionService.release(version);
        return ResultUtil.success("发布成功");
    }







}
